package com.le.tester.onjava8.l_2_2_6;

import com.le.tester.javaThink.fifth.chapter24_ConcurrentProgramming.CachedThreadPool;
import org.apache.commons.lang3.ThreadUtils;

/**
 * createTime：2023/1/7 16:00
 * description：克隆组合对象
 */
public class TemperatureReading implements Cloneable {

    private long time;

    private double temperature;

    public TemperatureReading(double temperature) {
        time = System.currentTimeMillis();
        this.temperature = temperature;
    }

    public TemperatureReading clone() {
        try {
            return (TemperatureReading) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
    }

    public double getTemperature() {
        return temperature;
    }

    public void setTemperature(double temperature) {
        this.temperature = temperature;
    }

    @Override
    public String toString() {
        return String.valueOf(temperature);
    }


}
